home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
SciAn
/
src
/
ScianMenus.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
25KB
|
1,087 lines
/*ScianMenus.c
Eric Pepke
August 8, 1992
Handles menus for SciAn
*/
#include "Scian.h"
#include "ScianTypes.h"
#include "ScianWindows.h"
#include "ScianLists.h"
#include "ScianColors.h"
#include "ScianErrors.h"
#include "ScianIDs.h"
#include "ScianEvents.h"
#include "ScianDatasets.h"
#include "ScianHelp.h"
#include "ScianArrays.h"
#include "ScianFiles.h"
#include "ScianFontSystem.h"
#include "ScianDraw.h"
#include "ScianObjFunctions.h"
#include "ScianGlobalFunctions.h"
#include "ScianStyle.h"
#include "ScianErrors.h"
#include "ScianRecorders.h"
#include "ScianAnimation.h"
#include "ScianSymbols.h"
#include "ScianDatabase.h"
#include "ScianMenus.h"
#include "ScianTextBoxes.h"
ObjPtr menuClass; /*Class of menus*/
ObjPtr actionClass; /*Class of actions*/
ObjPtr textSizeActionClass; /*Class of text size actions*/
ObjPtr mainMenu; /*Main menu*/
ObjPtr fileMenu; /*File menu*/
ObjPtr datasetsMenu; /*Datasets menu*/
ObjPtr objectMenu; /*Object menu*/
ObjPtr arrangeMenu; /*Arrange menu*/
ObjPtr networkMenu; /*Network menu*/
ObjPtr deusMenu; /*Deus menu*/
ObjPtr windowMenu; /*Window menu*/
ObjPtr animationMenu; /*Animation menu*/
ObjPtr locationMenu; /*Window location menu*/
ObjPtr tileMenu; /*Tile menu*/
ObjPtr textMenu; /*Text menu*/
ObjPtr fontSizeMenu; /*Text size submenu*/
ObjPtr alignMenu; /*Text alignment submenu*/
ObjPtr fontMenu; /*Font submenu*/
ObjPtr colorMenu; /*Color submenu*/
ObjPtr colorModelMenu; /*Color model submenu*/
ObjPtr hiddenMenu; /*Hidden menu, for random things.*/
#ifdef MENUS4D
static int nStoredActions = 0; /*Number of stored actions for old routines*/
static ObjPtr *storedActions = 0;
static int nStoredActionsAllocated = 0; /*Number of stored items allocated*/
#endif
static ObjPtr keyActions[MAX_KEYS][4];
#ifdef PROTO
ObjPtr NewMenu(char *name)
#else
ObjPtr NewMenu(name)
char *name;
#endif
/*Makes a new menu with name*/
{
ObjPtr retVal;
retVal = NewObject(menuClass, 0L);
if (retVal)
{
SetVar(retVal, NAME, NewString(name));
}
return retVal;
}
#ifdef PROTO
void AddMenuItem(ObjPtr menu, ObjPtr item, int group)
#else
void AddMenuItem(menu, item, group)
ObjPtr menu;
ObjPtr item;
int group;
#endif
/*Adds item to menu. Group is the menu item group*/
{
ObjPtr items;
ObjPtr var;
ObjPtr *elements;
long dim;
SetVar(item, ITEMGROUP, NewInt(group));
items = GetVar(menu, ITEMS);
if (!items)
{
dim = 1;
items = NewArray(AT_OBJECT, 1, &dim);
elements = ELEMENTS(items);
elements[0] = item;
}
else
{
elements = ELEMENTS(items);
for (dim = 0; dim < DIMS(items)[0]; ++dim)
{
var = GetVar(elements[dim], ITEMGROUP);
if (var)
{
if (GetInt(var) > group) break;
}
}
items = InsertInArray(items, item, dim);
}
SetVar(menu, ITEMS, items);
SetVar(item, PARENT, menu);
}
#ifdef PROTO
ObjPtr NewAction(char *name, ObjPtr class)
#else
ObjPtr NewAction(name, class)
char *name;
ObjPtr class;
#endif
/*Returns a new action*/
{
ObjPtr retVal;
retVal = NewObject(class ? class : actionClass, 0L);
if (name)
{
SetVar(retVal, NAME, NewString(name));
}
#ifdef MENUS4D
if (nStoredActions >= nStoredActionsAllocated)
{
if (nStoredActionsAllocated)
{
nStoredActionsAllocated += 100;
storedActions = Realloc(storedActions, nStoredActionsAllocated * sizeof(ObjPtr));
}
else
{
nStoredActionsAllocated = 100;
storedActions = Alloc(nStoredActionsAllocated * sizeof(ObjPtr));
}
}
{
/*Allocate a menu helper*/
storedActions[nStoredActions] = retVal;
SetVar(retVal, STOREDACTION, NewInt(nStoredActions));
++nStoredActions;
}
#endif
return retVal;
}
#ifdef PROTO
ObjPtr NewSimpleAction(char *name, FuncTyp action)
#else
ObjPtr NewSimpleAction(name, action)
char *name;
FuncTyp action;
#endif
/*Makes a new simple action*/
{
ObjPtr retVal;
retVal = NewAction(name, actionClass);
if (retVal)
{
SetMethod(retVal, ACTIONMETHOD, action);
}
return retVal;
}
#ifdef MENUS4D
void ActionHelper(n)
long n;
/*Helper for actions on a GL menu*/
{
ObjPtr action;
FuncTyp method;
action = storedActions[n];
if (!action)
{
ReportError("ActionHelper", "No stored action");
}
method = GetMethod(action, ACTIONMETHOD);
if (method)
{
(*method)(action);
}
}
ObjPtr MakeGLMenuStructure(menu)
ObjPtr menu;
/*Makes a menu structure for a GL menu*/
{
ObjPtr items;
ThingListPtr runner;
ObjPtr var, item;
long pup;
int storedAction, nextStoredAction;
char *name;
/*Get rid of old menu*/
var = GetVar(menu, MENUSTRUCTURE);
if (var)
{
freepup((long) GetInt(var));
SetVar(menu, MENUSTRUCTURE, NULLOBJ);
}
MakeVar(menu, NAME);
var = GetVar(menu, NAME);
pup = newpup();
if (GetPredicate(menu, HASTITLE))
{
sprintf(tempStr, "%%t%s", var ? GetString(var) : "??");
addtopup(pup, tempStr);
}
items = GetVar(menu, ITEMS);
if (items)
{
ObjPtr *elements;
long k;
long curGroup = 0;
Bool withLine = false;
elements = ELEMENTS(items);
var = GetVar(elements[0], ITEMGROUP);
if (var)
{
curGroup = GetInt(var);
}
for (k = 0; k < DIMS(items)[0]; ++k)
{
item = elements[k];
var = GetVar(item, CLASSID);
if (var && (GetInt(var) == CLASS_ACTION))
{
char *s;
/*It's an action. Put it in the menu*/
var = GetIntVar("MakeGLMenuStructure", item, STOREDACTION);
if (!var) continue;
storedAction = GetInt(var);
MakeVar(item, NAME);
var = GetStringVar("MakeGLMenuStructure", item, NAME);
if (!var) continue;
name = GetString(var);
withLine = false;
if (k < DIMS(items)[0] - 1)
{
var = GetVar(elements[k + 1], ITEMGROUP);
if (var && GetInt(var) > curGroup)
{
withLine = true;
curGroup = GetInt(var);
}
}
s = tempStr;
strcpy(s, name);
while (*s) ++s;
if (withLine)
{
strcpy(s, "%l");
}
while (*s) ++s;
var = GetVar(item, FUNCTIONKEY);
if (var)
{
int fk, flags;
fk = GetInt(var);
var = GetVar(item, FUNCTIONFLAGS);
if (var)
{
flags = GetInt(var) & 3;
}
else
{
flags = 0;
}
strcpy(s, " [");
++s;
++s;
switch (flags)
{
case F_SHIFTDOWN:
strcpy(s, "Shift-");
break;
case F_OPTIONDOWN:
strcpy(s, "Alt-");
break;
case F_SHIFTDOWN + F_OPTIONDOWN:
strcpy(s, "Shift-Alt-");
break;
}
while (*s) ++s;
if (fk < 256)
{
sprintf(s, "%c", fk);
}
else if (fk >= FK_BASE)
{
sprintf(s, "%s", functionKeyNames[fk - FK_BASE] ? functionKeyNames[fk - FK_BASE] : "?");
}
else
{
strcpy(s, "?");
}
while (*s) ++s;
strcpy(s, "]");
++s;
}
sprintf(s, "%%x%d", storedAction);
while (*s) ++s;
strcpy(s, "%f");
addtopup(pup, tempStr, ActionHelper);
}
else if (var && (GetInt(var) == CLASS_MENU))
{
/*It's a menu. Make it.*/
long subMenu;
MakeVar(item, MENUSTRUCTURE);
var = GetVar(item, MENUSTRUCTURE);
if (!var) continue;
subMenu = (long) GetInt(var);
MakeVar(item, NAME);
var = GetStringVar("MakeGLMenuStructure", item, NAME);
if (!var) continue;
name = GetString(var);
withLine = false;
if (k < DIMS(items)[0] - 1)
{
var = GetVar(elements[k + 1], ITEMGROUP);
if (var && GetInt(var) > curGroup)
{
withLine = true;
curGroup = GetInt(var);
}
}
if (withLine)
{
sprintf(tempStr, "%s%%l%%m", name);
}
else
{
sprintf(tempStr, "%s%%m", name);
}
addtopup(pup, tempStr, subMenu);
}
else
{
ReportError("MakeGLMenuStructure", "Bad menu item");
}
}
}
SetVar(menu, MENUSTRUCTURE, NewInt((int) pup));
}
ObjPtr CleanupGLMenuStructure(menu)
ObjPtr menu;
/*Cleans up the GL menu structure*/
{
ObjPtr var;
var = GetVar(menu, MENUSTRUCTURE);
if (var)
{
freepup((long) GetInt(var));
}
return ObjTrue;
}
#endif
#ifdef PROTO
void ChooseMenuActivation(ObjPtr menu)
#else
void ChooseMenuActivation(menu)
ObjPtr menu;
#endif
/*Chooses whether items in a menu are activated or not*/
{
ObjPtr *elements;
ObjPtr var;
long k;
long dim;
Bool anyActivated = false;
#ifdef MENUS4D
long menuStructure = 0;
var = GetVar(menu, MENUSTRUCTURE);
if (var) menuStructure = GetInt(var);
#endif
if (GetMethod(menu, ACTIVATED))
{
MakeVar(menu, ACTIVATED);
}
else
{
var = GetVar(menu, ITEMS);
if (var)
{
Bool thisActivated;
elements = ELEMENTS(var);
dim = DIMS(var)[0];
for (k = 0; k < dim; ++k)
{
var = GetVar(elements[k], CLASSID);
if (var && GetInt(var) == CLASS_MENU)
{
/*Activate all the items on this menu*/
ChooseMenuActivation(elements[k]);
}
SetVar(elements[k], READYTOACTIVATE, ObjTrue);
MakeVar(elements[k], ACTIVATED);
thisActivated = GetPredicate(elements[k], ACTIVATED);
if (thisActivated) anyActivated = true;
#ifdef MENUS4D
#ifdef PUP_GREY
#ifdef PUP_NONE
if (menuStructure)
setpup(menuStructure, k
#ifndef MENUSFROM0
+ 1
#endif
, thisActivated || contextHelp ? PUP_NONE : PUP_GREY);
#endif
#endif
#endif
}
}
SetVar(menu, ACTIVATED, anyActivated ? ObjTrue : ObjFalse);
}
}
#ifdef PROTO
void DrawFSOverMenu(ObjPtr menu, int x, int y)
#else
void DrawFSOverMenu(menu, x, y)
#endif
/*Draws an overlay menu, full screen*/
{
int l, r, b, t;
int width, height, w;
int nItems;
ObjPtr *items;
ObjPtr var;
int k;
int group;
/*Get the menu's items*/
MakeVar(menu, ITEMS);
var = GetVar(menu, ITEMS);
if (!var)
{
return;
}
nItems = DIMS(var)[0];
items = ELEMENTS(var);
/*Find size of menu*/
height = nItems * (MENUFONTSIZE + MENUTBORDER + MENUBBORDER);
width = 0;
for (k = 0; k < nItems; ++k)
{
MakeVar(items[k], NAME);
var = GetVar(items[k], NAME);
if (var)
{
w = StrWidth(GetString(var));
if (w > width) width = w;
}
}
/*Put in space for left and right borders*/
width += MENULBORDER + MENURBORDER;
if (x + width > scrWidth)
{
x = scrWidth - width;
}
if (y - height < 0)
{
y = height;
}
/*Make the back of the menu*/
FillUIRect(x, x + width + 1, y - height, y + 1, UIOVERGRAY);
FillUIGauzeRect(x, x + width + 1, y - height, y + 1, UIOVERWHITE);
/*Make the border around the menu*/
/* bottom */
SetUIColor(UIOVERGRAY);
FillIntQuad(x + 1, y + 1 - height,
x + 1 - MENUEDGE, y + 1 - height - MENUEDGE,
x + 1 + width + MENUEDGE, y + 1 - height - MENUEDGE,
x + 1 + width, y + 1 - height);
/* left */
SetUIColor(UIOVERWHITE);
FillIntQuad(x + 1, y + 1,
x + 1 - MENUEDGE, y + 1 + MENUEDGE,
x + 1 - MENUEDGE, y + 1 - height - MENUEDGE,
x + 1, y + 1 - height);
/* right */
SetUIColor(UIOVERGRAY);
FillIntQuad(x + 1 + width, y + 1,
x + 1 + width, y + 1 - height,
x + 1 + width + MENUEDGE, y + 1 - height - MENUEDGE,
x + 1 + width + MENUEDGE, y + 1 + MENUEDGE);
/* top */
SetUIColor(UIOVERWHITE);
FillIntQuad(x + 1 - MENUEDGE, y + 1+ MENUEDGE,
x + 1, y + 1,
x + 1 + width, y + 1,
x + 1 + width + MENUEDGE, y + 1 + MENUEDGE);
FrameUIRect(x - MENUEDGE - 1, x + 1 + width + MENUEDGE,
y - height - MENUEDGE - 1, y + 1 + MENUEDGE,
UIOVERBLACK);
/*Draw the names*/
for (k = 0; k < nItems; ++k)
{
var = GetVar(items[k], NAME);
if (var)
{
MakeVar(items[k], ACTIVATED);
SetUIColor(GetPredicate(items[k], ACTIVATED) ? UIOVERBLACK : UIOVERGRAY);
DrawAString(LEFTALIGN, x + MENULBORDER,
y - k * (MENUFONTSIZE + MENUTBORDER + MENUBBORDER) - MENUTBORDER - MENUFONTSIZE,
GetString(var));
}
}
/*Draw the groups*/
group = 0;
for (k = 0; k < nItems; ++k)
{
var = GetVar(items[k], ITEMGROUP);
if (var)
{
if (GetInt(var) > group)
{
group = GetInt(var);
DrawUILine(x, y - (k - 1) * (MENUTBORDER + MENUFONTSIZE + MENUBBORDER),
x + width - 1, y - (k - 1) * (MENUTBORDER + MENUFONTSIZE + MENUBBORDER),
UIOVERGRAY);
DrawUILine(x, y - 1 - (k - 1) * (MENUTBORDER + MENUFONTSIZE + MENUBBORDER),
x + width - 1, y - 1 - (k - 1) * (MENUTBORDER + MENUFONTSIZE + MENUBBORDER),
UIOVERWHITE);
}
}
}
}
#ifdef PROTO
void DoMenu(ObjPtr menu, int x, int y)
#else
void DoMenu(menu, x, y)
ObjPtr menu;
int x, y;
#endif
/*Does menu in menu, with beginning point in x and y*/
{
#ifdef MENUSGLOVER
int newX, newY;
#endif
#ifdef MENUS4D
ObjPtr var;
long pup;
#endif
#ifdef MENUSGLOVER
if (nOverDrawPlanes >= 2)
{
ChooseMenuActivation(menu);
FullScreen(true);
OverDrawMenus(true);
SetUIFont(UIMENUFONT);
DrawFSOverMenu(menu, x, y);
while (Mouse(&newX, &newY));
SetUIColor(UIOVERCLEAR);
EraseAll();
OverDrawMenus(false);
FullScreen(false);
return;
}
#endif
#ifdef MENUS4D
MakeVar(menu, MENUSTRUCTURE);
ChooseMenuActivation(menu);
var = GetIntVar("DoMenu", menu, MENUSTRUCTURE);
if (var)
{
dopup((long) GetInt(var));
return;
}
#endif
}
static ObjPtr MakeFontSizeActivated(menu)
ObjPtr menu;
/*Makes the font size menu activated or not*/
{
ObjPtr allSelected;
ThingListPtr runner;
ObjPtr var;
var = GetStringVar("MakeFontSizeActivated", menu, NAME);
if (!var) return ObjFalse;
allSelected = GetListVar("MakeFontSizeActivated", menu, ALLSELECTED);
if (allSelected)
{
for (runner = LISTOF(allSelected); runner; runner = runner -> next)
{
if (GetMethod(runner -> thing, SETTEXTSIZE))
{
SetVar(menu, ACTIVATED, ObjTrue);
return ObjTrue;
}
}
}
SetVar(menu, ACTIVATED, ObjFalse);
return ObjTrue;
}
static ObjPtr MakeFontActivated(menu)
ObjPtr menu;
/*Makes the font menu activated or not*/
{
ObjPtr allSelected;
ThingListPtr runner;
ObjPtr var;
var = GetStringVar("MakeFontSizeActivated", menu, NAME);
if (!var) return ObjFalse;
allSelected = GetListVar("MakeFontSizeActivated", menu, ALLSELECTED);
if (allSelected)
{
for (runner = LISTOF(allSelected); runner; runner = runner -> next)
{
if (GetMethod(runner -> thing, SETTEXTFONT))
{
SetVar(menu, ACTIVATED, ObjTrue);
return ObjTrue;
}
}
}
SetVar(menu, ACTIVATED, ObjFalse);
return ObjTrue;
}
#ifdef PROTO
void SpitOutMenu(ObjPtr menu, int level)
#else
void SpitOutMenu(menu, level)
ObjPtr menu;
int level;
#endif
/*Spits out a menu at level*/
{
ObjPtr *items;
ObjPtr item;
int nItems, k;
char *help, name[200];
char modHelp[1000];
char *s, *d;
ObjPtr var;
MakeVar(menu, ITEMS);
var = GetVar(menu, ITEMS);
items = ELEMENTS(var);
nItems = DIMS(var)[0];
for (k = 0; k < nItems; ++k)
{
item = items[k];
var = GetVar(item, CLASSID);
if (var && GetInt(var) == CLASS_MENU)
{
if (!GetPredicate(item, HALTAUTODOC))
{
MakeVar(item, NAME);
var = GetVar(item, NAME);
if (level < 2)
{
printf("The %s menu\n", GetString(var));
}
}
}
MakeVar(item, NAME);
var = GetStringVar("SpitOutMenu", item, NAME);
strcpy(name, GetString(var));
d = name;
while (*d) ++d;
--d;
while (*d == '.') --d;
++d;
*d = 0;
var = GetVar(item, HELPSTRING);
if (!var)
{
printf("WARNING! No HELPSTRING on %s\n", name);
continue;
}
help = GetString(var);
if (strstr(help, "Choosing this menu item"))
{
s = help + strlen("Choosing this menu item");
sprintf(modHelp, "The %s item", name);
d = modHelp;
while (*d) ++d;
strcpy(d, s);
}
else if (strstr(help, "Choosing this item"))
{
s = help + strlen("Choosing this item");
sprintf(modHelp, "The %s item", name);
d = modHelp;
while (*d) ++d;
strcpy(d, s);
}
else if (strstr(help, "This menu"))
{
s = help + strlen("This menu");
sprintf(modHelp, "The %s menu", name);
d = modHelp;
while (*d) ++d;
strcpy(d, s);
}
else strcpy(modHelp, help);
printf("%s\n", modHelp);
var = GetVar(item, CLASSID);
if (var && GetInt(var) == CLASS_MENU)
{
if (!GetPredicate(item, HALTAUTODOC))
{
SpitOutMenu(item, level + 1);
}
}
}
}
#ifdef PROTO
void EmitMenuDoc(void)
#else
void EmitMenuDoc()
#endif
/*Automatically emits documentation for all menu items to standard output.
Wow!
*/
{
SpitOutMenu(mainMenu, 0);
}
#ifdef PROTO
ObjPtr FindMenuItem(ObjPtr menu, char *actionName)
#else
ObjPtr FindMenuItem(menu, actionName)
ObjPtr menu;
char *actionName;
#endif
/*Finds a menu item in menu named actionName*/
{
ObjPtr var;
ObjPtr *items;
ObjPtr action;
int k;
MakeVar(menu, NAME);
var = GetVar(menu, NAME);
if (var)
{
if (0 == strcmp2(actionName, GetString(var)))
{
return menu;
}
}
var = GetVar(menu, ITEMS);
if (var)
{
items = ELEMENTS(var);
for (k = 0; k < DIMS(var)[0]; ++k)
{
action = FindMenuItem(items[k], actionName);
if (action) return action;
}
}
return NULLOBJ;
}
#ifdef PROTO
void DefineFunctionKey(int key, int flags, char *actionName)
#else
void DefineFunctionKey(key, flags, actionName)
int key;
int flags;
char *actionName;
#endif
/*Defines a function key given from key and flags to do an action located
using actionName. Only F_SHIFTDOWN and F_ALTDOWN are used*/
{
int modFlags;
ObjPtr action;
modFlags = flags & 3;
action = FindMenuItem(mainMenu, actionName);
if (!action)
{
action = FindMenuItem(hiddenMenu, actionName);
if (!action)
{
char outStr[100];
sprintf(outStr, "Action %s is not found\n", actionName);
ReportError("DefineFunctionKey", outStr);
return;
}
}
if (keyActions[key][flags])
{
/*Clean up the old one*/
SetVar(keyActions[key][flags], FUNCTIONKEY, NULLOBJ);
SetVar(keyActions[key][flags], FUNCTIONFLAGS, NULLOBJ);
}
SetVar(action, FUNCTIONKEY, NewInt(key));
SetVar(action, FUNCTIONFLAGS, NewInt(modFlags));
keyActions[key][flags] = action;
}
#ifdef PROTO
Bool DoFunctionKey(int key, int flags)
#else
Bool DoFunctionKey(key, flags)
int key;
int flags;
#endif
/*Does a function key and returns true, or else returns false*/
{
ObjPtr action;
flags &= 3;
action = keyActions[key][flags];
if (action)
{
FuncTyp method;
method = GetMethod(action, ACTIONMETHOD);
if (method)
{
(*method)(action);
return true;
}
}
return false;
}
#ifdef PROTO
void InitMenus(void)
#else
void InitMenus()
#endif
/*Initializes the menu system*/
{
ObjPtr action;
int k;
/*Zero key actions*/
for (k = 0; k < MAX_KEYS; ++k)
{
keyActions[k][0] = NULLOBJ;
keyActions[k][1] = NULLOBJ;
keyActions[k][2] = NULLOBJ;
keyActions[k][3] = NULLOBJ;
}
/*Set up classes*/
menuClass = NewObject(NULLOBJ, 0L);
AddToReferenceList(menuClass);
SetVar(menuClass, CLASSID, NewInt(CLASS_MENU));
SetVar(menuClass, ACTIVATED, ObjTrue);
#ifdef MENUS4D
DeclareDependency(menuClass, MENUSTRUCTURE, ITEMS);
SetMethod(menuClass, MENUSTRUCTURE, MakeGLMenuStructure);
SetMethod(menuClass, CLEANUP, CleanupGLMenuStructure);
#endif
SetVar(menuClass, TYPESTRING, NewString("menu"));
actionClass = NewObject(NULLOBJ, 0L);
AddToReferenceList(actionClass);
SetVar(actionClass, ACTIVATED, ObjTrue);
SetVar(actionClass, CLASSID, NewInt(CLASS_ACTION));
SetVar(actionClass, TYPESTRING, NewString("menu item"));
/*Build the hidden menu*/
hiddenMenu = NewMenu("Function Keys");
AddToReferenceList(hiddenMenu);
SetVar(hiddenMenu, HELPSTRING,
NewString("This menu contains items only available through function keys."));
/*Build the file menu*/
fileMenu = NewMenu("File");
SetVar(fileMenu, HELPSTRING,
NewString("This menu contains items for working with disk files."));
/*Build the datasets menu*/
datasetsMenu = NewMenu("Dataset");
SetVar(datasetsMenu, HELPSTRING,
NewString("This menu contains items for working with datasets."));
/*Build the object menu*/
objectMenu = NewMenu("Object");
SetVar(objectMenu, HELPSTRING,
NewString("This menu contains items for working with miscellaneous objects."));
/*Build the arrange menu*/
arrangeMenu = NewMenu("Arrange");
AddMenuItem(objectMenu, arrangeMenu, 0);
SetVar(arrangeMenu, HELPSTRING,
NewString("This menu contains items for arranging 2-D drawing objects on space panels."));
/*Build the network menu*/
networkMenu = NewMenu("Network");
SetVar(networkMenu, HELPSTRING,
NewString("This menu contains items for connecting to other copies of SciAn over the network."));
/*Build the deus menu*/
deusMenu = NewMenu("Deus");
SetVar(deusMenu, HELPSTRING,
NewString("This menu contains items for the development of SciAn."));
/*Build the text menu*/
textMenu = NewMenu("Text");
SetVar(textMenu, HELPSTRING,
NewString("This menu contains items for working with text."));
/*Build the window menu*/
windowMenu = NewMenu("Window");
DeclareDependency(windowMenu, MENUSTRUCTURE, MOUSEWINDOW);
SetVar(windowMenu, HELPSTRING,
NewString("This menu contains items for working with windows."));
/*Build the location menu*/
locationMenu = NewMenu("Window Location");
AddMenuItem(windowMenu, locationMenu, 0);
SetVar(locationMenu, HELPSTRING,
NewString("This menu contains items for setting the location and size of windows."));
/*Build the tile menu*/
tileMenu = NewMenu("Window Tiling");
AddMenuItem(windowMenu, tileMenu, 0);
SetVar(tileMenu, HELPSTRING,
NewString("This menu contains items for tiling all the visualization windows on the screen."));
/*Build the animation menu*/
animationMenu = NewMenu("Animation");
SetVar(animationMenu, HELPSTRING,
NewString("This menu contains items for working with animation."));
/*Build the color menu*/
colorMenu = NewMenu("Color");
SetVar(colorMenu, HELPSTRING,
NewString("This menu contains items for editing color palettes within their control panels."));
/*Build the color model menu*/
colorModelMenu = NewMenu("Color Model");
AddMenuItem(colorMenu, colorModelMenu, 2);
SetVar(colorModelMenu, HELPSTRING,
NewString("This menu contains items for setting the color model used when editing a color palette. \
SciAn currently supports four color models: RGB (Red Green Blue), YIQ (NTSC color encoding), \
HSV (Hue Saturation Value), and HLS (Hue Lightness Saturation)."));
/*Build the font menu*/
fontMenu = NewMenu("Text Font");
DeclareDependency(fontMenu, ACTIVATED, ALLSELECTED);
SetMethod(fontMenu, ACTIVATED, MakeFontActivated);
SetVar(fontMenu, ACTIVATED, ObjFalse);
SetVar(fontMenu, HALTAUTODOC, ObjTrue);
AddMenuItem(textMenu, fontMenu, 2);
SetVar(fontMenu, HELPSTRING,
NewString("This menu contains a variety of text fonts. Select a group of \
text objects and choose a font to change all the text to that font."));
/*Build the size menu*/
fontSizeMenu = NewMenu("Text Size");
DeclareDependency(fontSizeMenu, ACTIVATED, ALLSELECTED);
SetMethod(fontSizeMenu, ACTIVATED, MakeFontSizeActivated);
SetVar(fontSizeMenu, ACTIVATED, ObjFalse);
SetVar(fontSizeMenu, HALTAUTODOC, ObjTrue);
AddMenuItem(textMenu, fontSizeMenu, 2);
SetVar(fontSizeMenu, HELPSTRING,
NewString("This menu contains a variety of text point sizes. Select a group of \
text objects and choose a text size to change all the text to that size."));
/*Build the align menu*/
alignMenu = NewMenu("Text Alignment");
AddMenuItem(textMenu, alignMenu, 2);
SetVar(alignMenu, HELPSTRING,
NewString("This menu contains three ways to align text with its borders."));
/*Build the main menu*/
mainMenu = NewMenu("SciAn");
AddToReferenceList(mainMenu);
DeclareDependency(mainMenu, MENUSTRUCTURE, MOUSEWINDOW);
SetVar(mainMenu, HASTITLE, ObjTrue);
AddMenuItem(mainMenu, fileMenu, 1);
#ifndef RELEASE
AddMenuItem(mainMenu, networkMenu, 1);
#endif
AddMenuItem(mainMenu, datasetsMenu, 1);
AddMenuItem(mainMenu, objectMenu, 1);
AddMenuItem(mainMenu, colorMenu, 1);
#ifdef GODLIKE
AddMenuItem(mainMenu, deusMenu, 1);
#endif
AddMenuItem(mainMenu, textMenu, 1);
AddMenuItem(mainMenu, windowMenu, 1);
AddMenuItem(mainMenu, animationMenu, 1);
}
#ifdef PROTO
void KillMenus(void)
#else
void KillMenus()
#endif
/*Kills the menu system*/
{
RemoveFromReferenceList(mainMenu);
RemoveFromReferenceList(hiddenMenu);
RemoveFromReferenceList(menuClass);
RemoveFromReferenceList(actionClass);
SAFEFREE(storedActions);
}